import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    //状态区域，定义数据的地方
    user:{
      name:'',
      phone:'',
      address:''
    },
    bool:true
  },
  mutations: {
    //相当于编写set方法
    setUser:function(state,LoginUser){
      state.user=LoginUser;
    },
    setBool:function(state,b){
      state.bool=b;
    }
  },
  actions: {
    //写一些异步的操作
    setUserAysnc:function(context,LoginUser){
      context.commit("setUser",LoginUser);
    }
  },
  modules: {
  }
})